home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / stngpasm / pure_c / include / sting / layer.sh < prev    next >
Encoding:
Text File  |  1997-08-13  |  6.8 KB  |  175 lines

  1. ;----------------------------------------------------------------------------
  2. ; File name:    LAYER.SH            Revision date:    1997.08.13
  3. ; Authors:    Peter Rottengatter  &        Creation date:    1997.03.26
  4. ;        Ronald Andersson        Version:    1.01
  5. ;----------------------------------------------------------------------------
  6. ; Purpose:    High level StinG protocol interfacing
  7. ;        Header file included in assembly
  8. ;----------------------------------------------------------------------------
  9. ;Required header declarations:
  10. ;
  11. ;    .include    "uran\STRUCT.SH"
  12. ;    .include    "sting\TRANSPORT.SH"
  13. ;    .include    "sting\LAYER.SH"
  14. ;
  15. ;copy the above to the header of your program and 'uncomment' the includes
  16. ;----------------------------------------------------------------------------
  17. ;
  18. ;#define MODULE_DRIVER    "MODULE_LAYER"
  19. ;
  20. ;----------------------------------------------------------------------------
  21. ;
  22. MAX_HANDLE    equ    64    ;Number of handles assigned by PRTCL_request
  23. ;
  24. ;----------------------------------------------------------------------------
  25. ;    High level protocol module descriptor.
  26. ;
  27.     struct     LAYER
  28.     char_p        LAYER_name        ; Name of layer
  29.     char_p        LAYER_version        ; Version of layer in xx.yy format
  30.     uint32        LAYER_flags        ; Private data
  31.     uint16        LAYER_date        ; Compile date in GEMDOS format
  32.     char_p        LAYER_author        ; Name of programmer
  33.     int16        LAYER_stat_dropped    ; Statistics of dropped data units
  34.     struct_p    LAYER_next        ; Next layer in driver chain
  35.     d_end    LAYER
  36. ;
  37. ;----------------------------------------------------------------------------
  38. ;    CN functions structure for TCP and UDP
  39. ;
  40.     struct    CN_FUNCS
  41.     func_p    CNkick        ;int16    cdecl    (* CNkick) (void *);
  42.     func_p    CNbyte_count    ;int16    cdecl    (* CNbyte_count) (void *);
  43.     func_p    CNget_char    ;int16    cdecl    (* CNget_char) (void *);
  44.     func_p    CNget_NDB    ;NDB    cdecl    (* CNget_NDB) (void *);
  45.     func_p    CNget_block    ;int16    cdecl    (* CNget_block) (void *, void *, int16);
  46.     func_p    CNgetinfo    ;CIB;    cdecl    (* CNgetinfo) (void *);
  47.     func_p    CNgets        ;int16    cdecl    (* CNgets) (void *, char *, int16, char);
  48.     d_end    CN_FUNCS
  49. ;
  50. ;----------------------------------------------------------------------------
  51. ;    Module driver structure / functions
  52. ;
  53.     struct    STX_head
  54.     char_p    STX_module;        ; Specific string that can be searched for
  55.     char_p    STX_author;        ; Any string
  56.     char_p    STX_version;        ; Format `00.00' Version:Revision
  57.     func_p    STX_set_dgram_ttl    ;void    cdecl    (* set_dgram_ttl) (IP_DGRAM *);
  58.     func_p    STX_check_dgram_ttl    ;int16    cdecl    (* check_dgram_ttl) (IP_DGRAM *);
  59.     func_p    STX_load_routing_table    ;int16    cdecl    (* load_routing_table) (void);
  60.     func_p    STX_set_sysvars        ;int32    cdecl    (* set_sysvars) (int16, int16);
  61.     func_p    STX_query_chains    ;void    cdecl    (* query_chains) (void **, void **, void **);
  62.     func_p    STX_IP_send        ;int16    cdecl    (* IP_send) (uint32, uint32, uint8, uint16, uint8, uint8, uint16, void *, uint16, void *, uint16);
  63.     func_p    STX_IP_fetch        ;IP_DGRAM * cdecl    (* IP_fetch) (int16);
  64.     func_p    STX_IP_handler        ;int16    cdecl    (* IP_handler) (int16, int16 cdecl (*) (IP_DGRAM *), int16);
  65.     func_p    STX_IP_discard        ;void    cdecl    (* IP_discard) (IP_DGRAM *, int16);
  66.     func_p    STX_PRTCL_announce    ;int16    cdecl    (* PRTCL_announce) (int16);
  67.     func_p    STX_PRTCL_get_parameters;int16    cdecl    (* PRTCL_get_parameters) (uint32, uint32 *, int16 *, uint16 *);
  68.     func_p    STX_PRTCL_request    ;int16    cdecl    (* PRTCL_request) (void *, CN_FUNCS *);
  69.     func_p    STX_PRTCL_release    ;void    cdecl    (* PRTCL_release) (int16);
  70.     func_p    STX_PRTCL_lookup    ;void;    cdecl    (* PRTCL_lookup) (int16, CN_FUNCS *);
  71.     func_p    STX_TIMER_call        ;int16    cdecl    (* TIMER_call) (void cdecl (*) (void), int16);
  72.     func_p    STX_TIMER_now        ;int32    cdecl    (* TIMER_now) (void);
  73.     func_p    STX_TIMER_elapsed    ;int32    cdecl    (* TIMER_elapsed) (int32);
  74.     d_end    STX_head
  75. ;
  76.     .import    stx            ;extern STX *stx;
  77. ;
  78. ;----------------------------------------------------------------------------
  79. ;    Definitions of module driver function macros for direct use
  80. ;----------------------------------------------------------------------------
  81. ;    Submacros are used to make the interface flexible and powerful
  82. ;
  83. ;sub_stx.mode    is used to implement all STX functions, and uses submacros
  84. ;        sub_sub_stx as well as some of URAn_SYS.SH.  It gives argument
  85. ;        count check for all macros, and allows indirection of pointers.
  86. ;----------------------------------------------------------------------------
  87. ;
  88. .MACRO    sub_stx.mode    function,arg_count,arg_flags,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11
  89.     CDECL_args.mode    arg_flags,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11
  90.     sub_sub_stx    STX_&function
  91.     CDECL_cleanargs    function,arg_count
  92. .ENDM    sub_stx
  93. ;
  94. ;-------------------------------------
  95. ;
  96. .MACRO    sub_sub_stx    stx_function
  97.     move.l    stx,a0
  98.     move.l    stx_function(a0),a0
  99.     jsr    (a0)
  100. .ENDM    sub_sub_stx
  101. ;
  102. ;----------------------------------------------------------------------------
  103. ;
  104. .MACRO    set_dgram_ttl.mode    dgram_p
  105.     sub_stx.mode    set_dgram_ttl,1,3,dgram_p
  106. .ENDM    set_dgram_ttl
  107. ;
  108. .MACRO    check_dgram_ttl.mode    dgram_p
  109.     sub_stx.mode    check_dgram_ttl,1,3,dgram_p
  110. .ENDM    check_dgram_ttl
  111. ;
  112. .MACRO    load_routing_table
  113.     sub_stx    load_routing_table,0,0
  114. .ENDM    load_routing_table
  115. ;
  116. .MACRO    set_sysvars    active_f,count_5ms
  117.     sub_stx    set_sysvars,2,5,active_f,count_5ms
  118. .ENDM    set_sysvars
  119. ;
  120. .MACRO    query_chains.mode    port_p,driver_p,layer_p
  121.     sub_stx.mode    query_chains,3,$3F,port_p,driver_p,layer_p
  122. .ENDM    query_chains
  123. ;
  124. .MACRO    IP_send.mode    s_IP,d_IP,tos,unfrag,ttl,proto,id,data_p,datalen,opt_p,optlen
  125.     sub_stx.mode    IP_send,11,$1DD04A,s_IP,d_IP,tos,unfrag,ttl,proto,id,data_p,datalen,opt_p,optlen
  126. .ENDM    IP_send
  127. ;
  128. .MACRO    IP_fetch    protocol
  129.     sub_stx    IP_fetch,1,1,protocol
  130. .ENDM    IP_fetch
  131. ;
  132. .MACRO    IP_handler.mode    protocol,handler_p,install_code
  133.     sub_stx.mode    IP_handler,3,$1D,protocol,handler_p,install_code
  134. .ENDM    IP_handler
  135. ;
  136. .MACRO    IP_discard.mode    dgram_p,all_f
  137.     sub_stx.mode    IP_discard,2,7,dgram_p,all_f
  138. .ENDM    IP_discard
  139. ;
  140. .MACRO    PRTCL_announce    protocol
  141.     sub_stx    PRTCL_announce,1,1,protocol
  142. .ENDM    PRTCL_announce
  143. ;
  144. .MACRO    PRTCL_get_parameters.mode    remote_IP,local_IP_p,ttl_p,mtu_p
  145.     sub_stx.mode    PRTCL_get_parameters,4,$FE,remote_IP,local_IP_p,ttl_p,mtu_p
  146. .ENDM    PRTCL_get_parameters
  147. ;
  148. .MACRO    PRTCL_request.mode    cn_data_p,cn_funcs_p
  149.     sub_stx.mode    PRTCL_request,2,$F
  150. .ENDM    PRTCL_request
  151. ;
  152. .MACRO    PRTCL_release    cn_handle
  153.     sub_stx    PRTCL_release,1,1,cn_handle
  154. .ENDM    PRTCL_release
  155. ;
  156. .MACRO    PRTCL_lookup.mode    cn_handle,cn_funcs_p
  157.     sub_stx.mode    PRTCL_lookup,2,$D,cn_handle,cn_funcs_p
  158. .ENDM    PRTCL_lookup
  159. ;
  160. .MACRO    TIMER_call.mode    handler_p,install_code
  161.     sub_stx.mode    TIMER_call,2,7,handler_p,install_code
  162. .ENDM    TIMER_call
  163. ;
  164. .MACRO    TIMER_now
  165.     sub_stx    TIMER_now,0,0
  166. .ENDM    TIMER_now
  167. ;
  168. .MACRO    TIMER_elapsed    old_time
  169.     sub_stx    TIMER_elapsed,1,2,old_time
  170. .ENDM    TIMER_elapsed
  171. ;
  172. ;----------------------------------------------------------------------------
  173. ; End of file:    LAYER.SH
  174. ;----------------------------------------------------------------------------
  175.